package club.xinghe.servlet.teacher;


import club.xinghe.biz.GradeBiz;
import club.xinghe.entity.Grade;
import club.xinghe.entity.Teacher;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;
import java.util.List;

@WebServlet("/teacher/addExamServlet")
public class addExamServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        HttpSession session = request.getSession();
        Teacher teacher = (Teacher) session.getAttribute("teacher");

        int zid = teacher.getZy().getzId();
        int yid = teacher.getYx().getyId();
        int teacherid = teacher.getTeacherId();

        GradeBiz gradeBiz = new GradeBiz();
        List<Grade> list = gradeBiz.showGrade();


        session.setAttribute("zid",zid);
        session.setAttribute("yid",yid);
        session.setAttribute("teacherid",teacherid);
        session.setAttribute("list",list);
        response.sendRedirect("/teacher/addExam.jsp");
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {

    }
}
